page.tsx
1import { LinksPage } from '@/components/links-page'
2import { generateMeta } from '@/lib/generateMeta'
3import { Metadata } from 'next'
4import { config } from '@/configs/main'
5import { notFound } from 'next/navigation'
6
7interface Props {
8 params: { name: string }
9}
10
11export async function generateMetadata({ params }: Props): Promise<Metadata> {
12 const link = [...(config.socials || []), ...(config.links || [])].find(
13 (l) => l.name.toLowerCase() === params.name.toLowerCase(),
14 )
15 if (!link) return notFound()
16
17 return generateMeta({
18 title: `${link.name} Link`,
19 description: `Direct link to ${config.name}'s ${link.name}`,
20 })
21}
22
23export default function LinkRedirect({ params }: Props) {
24 const link = [...(config.socials || []), ...(config.links || [])].find(
25 (l) => l.name.toLowerCase() === params.name.toLowerCase(),
26 )
27 if (!link) return notFound()
28
29 return <LinksPage selectedLink={link} />
30}
31